//require.context
const routesModules = import.meta.globEager("./routes/*.tsx");
//这是一个对象key路径名 值是模块
const routesConfig = Object.keys(routesModules).map(url => {
  //url = ./routes/Home.tsx
  const name = url.match(/\.\/routes\/(.+)\.tsx$/)![1].toLowerCase();//home user profile
  const Component = routesModules[url].default;// User Profile Home
  return {
    path: name === 'home' ? '/' : '/' + name,
    element: <Component />
  }
});
export default routesConfig;